package iontec.elements;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.util.AttributeSet;
import android.widget.TextView;

public class ColorByValueTextView extends TextView {
	    public ColorByValueTextView(Context context, AttributeSet attrs, int defStyle) {
	        super(context, attrs, defStyle);
	    }

	    public ColorByValueTextView(Context context, AttributeSet attrs) {
	        super(context, attrs);
	    }

	    public ColorByValueTextView(Context context) {
	        super(context);
	    }

	    @Override
	    protected void onDraw(Canvas canvas) {
	    	
	    	String text = (String)this.getText();

	    	if (Integer.valueOf(text)>0) this.setTextColor(Color.GREEN); else this.setTextColor(Color.RED)  ;
	    	super.onDraw(canvas);
	    }
}
